<template>
  <div>
    <h2>这个页面用来测试我们项目中用到的技术</h2>
    <h3>1.0 操作 cookies</h3>
    <div><el-button @click="setCookie">设置 cookie</el-button></div>
    <div><el-button @click="getCookie">获取 cookie</el-button></div>
    <div><el-button @click="removeCookie">删除 cookie</el-button></div>
  </div>
</template>

<script>
// 直接导入 cookie
import cookie from 'js-cookie'
export default {
  methods: {
    // 设置 cookie
    setCookie () {
      cookie.set('myname', 'xjj')
      console.log('myname 存储成功')
    },
    // 获取 cookie
    getCookie () {
      const res = cookie.get('myname')
      console.log('获取 cookie 成功', res)
    },
    // 删除 cookie
    removeCookie () {
      cookie.remove('myname')
      console.log('cookie删除成功')
    }
  }
}
</script>

